#ifndef SIMPLE_GRID_H
#define SIMPLE_GRID_H

#include "Grid.h"

class SimpleGrid : public Grid {

public:
	/* ctors */
	SimpleGrid(int width, int height);
	SimpleGrid(Grid const& grid);

	/* dtor */
	~SimpleGrid();

	/* set/get tile */
	void setTile(int x, int y, int value);
	inline int getTile(int x, int y) const {
		return _data[doGetIndex(x, y)];
	}

	/* width/height */
	int getWidth() const;
	int getHeight() const;

private:
	/* width/height */
	int _width;
	int _height;

	/* data */
	int* _data;

	/* (x, y) => _data index */
	inline int doGetIndex(int x, int y) const {
		return y * _width + x;
}
};

#endif	// SIMPLE_GRID_H

